Repository navigation
Design: a framework-agnostic projection store - #123
Merged
Merged
Conversation
A proposal for `createProjection`, a store any framework can subscribe to, with `useProjection` as its React adapter and `mountStage` as a stage without React, composed from the machine package's playback machine, a pane-status machine and selectors, in six pull-request-sized steps. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The proposal leaves a Strict Mode lifecycle issue unresolved: cleanup destroys the preserved store instance, while initializer-started activities can leak, requiring side-effect-free construction and restartable activation/deactivation.
1 open issue
What changed in this PR
This documentation-only PR proposes extracting host-core orchestration into a framework-agnostic store, allowing non-React hosts to reuse it while preserving the existing ProjectionController API.
Changes:
- Defines
createProjection, a vanilla-DOMmountStage, and a thin React adapter. - Describes composition around settings, playback, pane status, selectors, and selection, building on #110, #115, and #122.
- Outlines timing requirements and six incremental implementation steps with Node-based orchestration tests.
| File | Description |
|---|---|
docs/design/proposals/headless-store.md |
Adds the proposed store API, architecture, lifecycle requirements, and migration plan. |
Review effort: Balanced
…troyed in cleanup Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is item G4 of the headless-host plan: a design note to agree on before the code. It is documentation only.
The problem
useProjectionis the core's whole orchestration, written as about thirty React hooks. So:controllerRef) with no subscription;The proposal
docs/design/proposals/headless-store.md:createProjection(options)returnsgetSnapshot,subscribe,update, the controller's actions unchanged, anddestroy;mountStage(element, projection, …)is the stage without React;useProjectionbecomes auseSyncExternalStoreadapter.requesteffects;playbackLifecycle(Host core: playback's lifecycle as a state machine, with one stop path #115), run bycreateActor;ProjectionControllerand the browser suites unchanged. Steps 1–4 add node tests for orchestration that only browser specs cover today.The State machine survey session agreed that I compose the store on its machine package, and that its playback machine is the store's core. Implementation starts after #110, #115 and #122 merge.